<template>
	<view>
		<cu-custom bgColor="theme-bg-color" :isBack="true">
			<block slot="content">组 织 申 请</block>
		</cu-custom>
		<form >
				<view class="cu-form-group align-start">
					<view class="title">申请理由</view>
					<textarea maxlength="-1" v-model="formData.Remark" placeholder="申请理由"></textarea>
				</view>
		
			<view class="padding margin-top">
				<button class="cu-btn block theme-bg-color margin-tb-sm lg" @click="Save()">提交</button>
			</view>
		</form>
	</view>
</template>

<script>
	import store from "@/store";
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				formData: {
					Remark:"",
					
				},
			}

		},
		computed: {
			...mapGetters(["userInfo", 'userId']),
		},
		onLoad(option) {
			this.OrganizationId = option.OrganizationId;
			this.formData.OrganizationId = option.OrganizationId;
			this.formData.UserId = this.userInfo.Id;
			
			this.GetTopicApi();
		},
		methods: {
			async Save() {
				if(!this.formData.Remark)
				{
					this.$comm.ShowToast("申请理由不能为空");
					return;
				}
				let confirm = await this.$comm.ShowModal("你确定要提交吗?");

				if (confirm == false) {
					await this.$comm.ShowToast("用户放弃操作");
					return;
				}
				let {
					Data,
					Success,
				} = await this.$http.PostAsync("/OrganizationRelativeUser/Apply", this.formData);
				if (Success) {
					await this.$comm.ShowToast("提交成功");
					await this.$comm.ReturnPage();
				}
			}
		}
	}
</script>

<style>

</style>